gotoObject(absno,m)

gotoObject issue
When I enter my dxl script I save the absolute number of the current object (absno)and set module m equal to current. Then I search all objects for a maximum value in one of the attributes, and now the last object in the module is the current object. Now I want to return to the original object to enter the maximum value I identified +1 into one of the attributes, so I use gotoObject(absno,m). This instruction moves to the correct object, but if I do o."absolute Number" or "identifier o", I am still pointed at the last object in the module.

Does anyone have more experience with this instruction or if this instruction is a problem, found a work-around? I would appreciate your input.
lahines - Fri Feb 03 09:36:19 EST 2012

Re: gotoObject(absno,m)
rain_bow - Fri Feb 03 09:44:24 EST 2012

Several methods to deal with situation.
Easiest probably is after using gotoObject use: o=current

Re: gotoObject(absno,m)
lahines - Fri Feb 03 09:56:57 EST 2012

rain_bow - Fri Feb 03 09:44:24 EST 2012
Several methods to deal with situation.
Easiest probably is after using gotoObject use: o=current

Thanks, and thanks for the prompt response. This fixed my problem and is certainly a simple solution. I thought 0=current was inherent in the command. The manual is somewhat obscure on this issue.

Re: gotoObject(absno,m)
llandale - Fri Feb 03 10:58:26 EST 2012

It seems I missed something, but I see no reason why the "current" object would change unless you changed it.

Object oCurr1 = current
Object obj
int MaxValue = 0, Max
for obj in entire mod do
{  Max = obj.SomeIntAttribute
   if (Max > MaxValue) then MaxValue = Max
}
Object oCurr2 = current
if (oCurr1 != oCurr2) then Louie is wrong
do something with MaxValue


About the only time you need "current = obj" in your code is when you want to display some new object:

 

  • current = obj
  • refresh(mod)
  • halt


IIRC, gotoObject(absno, m) only works when the object is currently displayed. ditto for "Object object(absno, m)"; which in my mind makes their usefulness limited.

-Louie

 

Re: gotoObject(absno,m)
lahines - Fri Feb 03 11:25:52 EST 2012

llandale - Fri Feb 03 10:58:26 EST 2012

It seems I missed something, but I see no reason why the "current" object would change unless you changed it.

Object oCurr1 = current
Object obj
int MaxValue = 0, Max
for obj in entire mod do
{  Max = obj.SomeIntAttribute
   if (Max > MaxValue) then MaxValue = Max
}
Object oCurr2 = current
if (oCurr1 != oCurr2) then Louie is wrong
do something with MaxValue


About the only time you need "current = obj" in your code is when you want to display some new object:

 

  • current = obj
  • refresh(mod)
  • halt


IIRC, gotoObject(absno, m) only works when the object is currently displayed. ditto for "Object object(absno, m)"; which in my mind makes their usefulness limited.

-Louie

 

For the max value search I first create a skip list of the objects I want to evaluate.
This may result in the current object changing, I don't know.
The for gotoObject(absno,m), I first do a "filtering off" command which exposes all objects in the module.

Re: gotoObject(absno,m)
llandale - Mon Feb 06 14:54:12 EST 2012

lahines - Fri Feb 03 11:25:52 EST 2012
For the max value search I first create a skip list of the objects I want to evaluate.
This may result in the current object changing, I don't know.
The for gotoObject(absno,m), I first do a "filtering off" command which exposes all objects in the module.

Actually you need something like this; but I see this very old function needs a little work on that "view" thing it does:

//*************************
void    fSetStandardDisplay(Module mod, bool DoView)
{     // Set the module to the standard display, showing all objects
        // in the natural hierarchical order, 
        // and optionally load the module's standard view.
 
        string  ViewName
                // Load the standard module view, if it
                // exists in the module.
        if (null mod) return
        Module  PrevCurr = fSetCurrMod(mod)
        if (DoView)
        {  for ViewName in views mod do
           {  if (ViewName == cl_vStandard    and
                  ViewName != currentView(mod))
                load view ViewName
           }
        }
        filtering       off
        graphics        off
        outlining       off
        showPictures    on
        showTables      on
        sorting         off
        showDeletedObjects(false)
        level(0)
 
        refresh mod
        fSetCurrMod(PrevCurr)   // reset to previous current module
}     // end fSetStandardDisplay()


-Louie